
#include "widget.h"
#include "ui_widget.h"
#include <QPushButton>
#include <QDebug>
Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);



    //QPushButton* button1  = new QPushButton(this);
    QPushButton* button2  = new QPushButton(this);
    //connect(button1,&QPushButton::clicked,this,&Widget::handleButton1);
    connect(button2,&QPushButton::clicked,this,&Widget::handleButton2);
    connect(ui->pushButton,&QPushButton::clicked,this,&Widget::handleButton1);
    //button1->setText("点击按钮");
    button2->setText("切换button状态");
    //button1->setEnabled(false);
    button2->move(0,100);

}

Widget::~Widget()
{
    delete ui;
}

void Widget::handleButton1()
{
    qDebug()<<"button1";
}

void Widget::handleButton2()
{
    ui->pushButton->setEnabled(!ui->pushButton->isEnabled());

}



